﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <!-- ARRAY CONFIG SCHEMA VERSION 1.0-->

  <!-- Main part of schema -->
  <xs:element name="ArrayConfigurationFile">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="VendorInfo" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>This section contains vendor-specific information. It's really for reference only and is not specifically used in the code.</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Name" type="xs:string" minOccurs="0" maxOccurs="1">
                <xs:annotation>
                  <xs:documentation>Vendor name</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="ProductName" type="xs:string" minOccurs="0" maxOccurs="1">
                <xs:annotation>
                  <xs:documentation>Product name</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="ProductVersion" type="xs:decimal" minOccurs="0" maxOccurs="1">
                <xs:annotation>
                  <xs:documentation>Version of the file / program</xs:documentation>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="ArrayConfigurationRule" minOccurs="1" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>This is the element that encloses the configuration specified in the wizard</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="RuleName" type="xs:string" minOccurs="1" maxOccurs="1">
                <xs:annotation>
                  <xs:documentation>A user-supplied name for the rule that allows them to provide a descriptive name.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="Controllers" minOccurs="1" maxOccurs="1">
                <xs:annotation>
                  <xs:documentation>Contains the individual controller configuration elements</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence minOccurs="1" maxOccurs="unbounded">
                    <xs:element maxOccurs="unbounded" name="Controller">
                      <xs:annotation>
                        <xs:documentation>Individual controller configuration element</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element minOccurs="1" maxOccurs="1" name="VariableConditions">
                            <xs:annotation>
                              <xs:documentation>Contains the individual variable condition configuration elements</xs:documentation>
                            </xs:annotation>
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element minOccurs="0" maxOccurs="unbounded" name="VariableCondition">
                                  <xs:annotation>
                                    <xs:documentation>Individual variable condition configuration element</xs:documentation>
                                  </xs:annotation>
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="Arrays" minOccurs="1" maxOccurs="1">
                                        <xs:annotation>
                                          <xs:documentation>Contains the individual array / virtual disk configuration elements</xs:documentation>
                                        </xs:annotation>
                                        <xs:complexType>
                                          <xs:sequence>
                                            <xs:element name="Array" minOccurs="1" maxOccurs="unbounded" >
                                              <xs:annotation>
                                                <xs:documentation>Individual array configuration element</xs:documentation>
                                              </xs:annotation>
                                              <xs:complexType>
                                                <xs:all>
                                                  <xs:element name="Disks" minOccurs="1" maxOccurs="1">
                                                    <xs:annotation>
                                                      <xs:documentation>Contains the individual disk configuration elements</xs:documentation>
                                                    </xs:annotation>
                                                    <xs:complexType>
                                                      <xs:sequence>
                                                        <xs:element name="Disk" minOccurs="0" maxOccurs="unbounded" >
                                                          <xs:annotation>
                                                            <xs:documentation>The individual drive(s) associated with this array</xs:documentation>
                                                          </xs:annotation>
                                                          <xs:complexType>
                                                            <xs:attribute name="Number" type="DiskNumber" use="required">
                                                              <xs:annotation>
                                                                <xs:documentation>The disk number to be used in this array. Disk number is the index of the disk as detected during deployment.</xs:documentation>
                                                              </xs:annotation>
                                                            </xs:attribute>
                                                            <xs:attribute name="Usage" type="DiskUse" use="required">
                                                              <xs:annotation>
                                                                <xs:documentation>How this drive will be used in the array (Standard or HotSpare)</xs:documentation>
                                                              </xs:annotation>
                                                            </xs:attribute>
                                                          </xs:complexType>
                                                        </xs:element>
                                                      </xs:sequence>
                                                    </xs:complexType>
                                                  </xs:element>
                                                  <xs:element name="LogicalDrives" minOccurs="0" maxOccurs="1">
                                                    <xs:complexType>
                                                      <xs:sequence minOccurs="1" maxOccurs="unbounded">
                                                        <xs:element name="LogicalDrive" minOccurs="0" maxOccurs="unbounded">
                                                          <xs:annotation>
                                                            <xs:documentation>The logical drive(s) associated with this array</xs:documentation>
                                                          </xs:annotation>
                                                          <xs:complexType>
                                                            <xs:attribute name="Number" type="DiskNumber" use="required">
                                                              <xs:annotation>
                                                                <xs:documentation>The logical drive number to be used in this array</xs:documentation>
                                                              </xs:annotation>
                                                            </xs:attribute>
                                                            <xs:attribute name="Size" type="LogicalDriveSize" use="required">
                                                              <xs:annotation>
                                                                <xs:documentation>The size (in GB or %) of the logical drive</xs:documentation>
                                                              </xs:annotation>
                                                            </xs:attribute>
                                                            <xs:attribute name="Type" type="LogicalDriveTypes" use="required">
                                                              <xs:annotation>
                                                                <xs:documentation>The size (in GB) of the logical drive</xs:documentation>
                                                              </xs:annotation>
                                                            </xs:attribute>
                                                            <xs:attribute name="FailOnError" type="xs:boolean" use="required">
                                                              <xs:annotation>
                                                                <xs:documentation>If the logical drive cannot be created, does the task fail or not?</xs:documentation>
                                                              </xs:annotation>
                                                            </xs:attribute>
                                                          </xs:complexType>
                                                        </xs:element>
                                                      </xs:sequence>
                                                    </xs:complexType>
                                                  </xs:element>
                                                </xs:all>
                                                <xs:attribute name="Name" type="ArrayName" use="required">
                                                  <xs:annotation>
                                                    <xs:documentation>Name of the array</xs:documentation>
                                                  </xs:annotation>
                                                </xs:attribute>
                                                <xs:attribute name="RaidLevel" type="RaidType" use="required">
                                                  <xs:annotation>
                                                    <xs:documentation>RAID level to assign to the array</xs:documentation>
                                                  </xs:annotation>
                                                </xs:attribute>
                                              </xs:complexType>
                                            </xs:element>
                                          </xs:sequence>
                                        </xs:complexType>
                                      </xs:element>
                                      <xs:element name="GlobalHotSpares" minOccurs="0" maxOccurs="unbounded" >
                                        <xs:annotation>
                                          <xs:documentation>Global hot spares configuration group</xs:documentation>
                                        </xs:annotation>
                                        <xs:complexType>
                                          <xs:sequence>
                                            <xs:element name="Disks" minOccurs="0" maxOccurs="1">
                                              <xs:complexType>
                                                <xs:sequence>
                                                  <xs:element name="Disk" minOccurs="0" maxOccurs="unbounded" >
                                                    <xs:annotation>
                                                      <xs:documentation>The individual drive(s) associated with this array</xs:documentation>
                                                    </xs:annotation>
                                                    <xs:complexType>
                                                      <xs:attribute name="Number" type="DiskNumber" use="required" >
                                                        <xs:annotation>
                                                          <xs:documentation>The drive number to be used in this array</xs:documentation>
                                                        </xs:annotation>
                                                      </xs:attribute>
                                                      <xs:attribute name="Usage" type="DiskUse" use="required">
                                                        <xs:annotation>
                                                          <xs:documentation>How this drive will be used in the array</xs:documentation>
                                                        </xs:annotation>
                                                      </xs:attribute>
                                                    </xs:complexType>
                                                  </xs:element>
                                                </xs:sequence>
                                              </xs:complexType>
                                            </xs:element>
                                          </xs:sequence>
                                        </xs:complexType>
                                      </xs:element>
                                    </xs:sequence>
                                    <xs:attribute name="VariableName" type="xs:string" use="optional">
                                      <xs:annotation>
                                        <xs:documentation></xs:documentation>
                                      </xs:annotation>
                                    </xs:attribute>
                                    <xs:attribute name="VariableValue" type="xs:string" use="optional">
                                      <xs:annotation>
                                        <xs:documentation></xs:documentation>
                                      </xs:annotation>
                                    </xs:attribute>
                                    <xs:attribute name="ComparisonOperator" type="ComparisonOperators" use="optional">
                                      <xs:annotation>
                                        <xs:documentation></xs:documentation>
                                      </xs:annotation>
                                    </xs:attribute>
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="Name" type="ControllerID"  use="required">
                        </xs:attribute>
                        <xs:attribute name="ControllerMatch" type="ControllerMatchType" use="optional">
                        </xs:attribute>
                        <xs:attribute name="SlotNumber" type="SlotType" use="optional">
                        </xs:attribute>
                        <xs:attribute name="NumberOfDisks" type="MinDisks" use="optional">
                        </xs:attribute>
                        <xs:attribute name="DiskMatch" type="DiskMatching" use="optional">
                        </xs:attribute>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="ActionOnFailure" type="FailActionType" use="required">
              <xs:annotation>
                <xs:documentation></xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="SchemaVersion" type="xs:decimal" use="optional">
        <xs:annotation>
          <xs:documentation>Version of the schema being used</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="Created" type="xs:dateTime"  use="optional">
        <xs:annotation>
          <xs:documentation>Date created (also for versioning)</xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
  
  
  <!-- Templates and restrictions -->
  <xs:simpleType name="DiskNumber">
    <xs:annotation>
      <xs:documentation>The drive number associated with the array controller.</xs:documentation>
    </xs:annotation>
    <xs:union>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:pattern value="[0-9]{1,2}">
            <xs:annotation>
              <xs:documentation>Any integer between 0 and 99, representing the drive number</xs:documentation>
            </xs:annotation>
          </xs:pattern>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="AllRemaining">
            <xs:annotation>
              <xs:documentation>Select all of the remaining drives beyond any previously selected by number.</xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="ArrayName">
    <xs:union>
      <xs:simpleType>
        <xs:annotation>
          <xs:documentation>The name of the array (such as "Array A")</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
          <xs:pattern value="[A-Z]">
            <xs:annotation>
              <xs:documentation>Any single capital letter from A to Z.</xs:documentation>
            </xs:annotation>
          </xs:pattern>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="None">
            <xs:annotation>
              <xs:documentation>No array name</xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="RaidType">
    <xs:annotation>
      <xs:documentation></xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="0">
        <xs:annotation>
          <xs:documentation>RAID 0 (striping)</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="1">
        <xs:annotation>
          <xs:documentation>RAID 1 (mirrored pair)</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="5">
        <xs:annotation>
          <xs:documentation>RAID 5 (data striping with parity)</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="6">
        <xs:annotation>
          <xs:documentation>RAID 6 ()</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="10">
        <xs:annotation>
          <xs:documentation>RAID 10 (stripe of mirrors)</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="50">
        <xs:annotation>
          <xs:documentation>RAID 50 (multiple RAID 5 sets in a single array)</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="60">
        <xs:annotation>
          <xs:documentation>RAID 60 ()</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Dynamic">
        <xs:annotation>
          <xs:documentation>RAID assigned by availability of disks: 1=RAID 0, 2=RAID 1, 3+ RAID 5</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="None">
        <xs:annotation>
          <xs:documentation>No RAID configured (JBOD)</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="DiskUse">
    <xs:annotation>
      <xs:documentation></xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="HotSpare">
        <xs:annotation>
          <xs:documentation>Drive will be used as a hot spare for the array</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="GlobalHotSpare">
        <xs:annotation>
          <xs:documentation>Drive will be used as a hot spare for the array</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Standard">
        <xs:annotation>
          <xs:documentation>Drive will be used in the array</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="DiskMatching">
    <xs:annotation>
      <xs:documentation></xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="Equal">
        <xs:annotation>
          <xs:documentation>Match a controller with exactly this number of drives</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="EqualOrGreater">
        <xs:annotation>
          <xs:documentation>Match a controller with this number of drives or more</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="MinDisks">
    <xs:annotation>
      <xs:documentation></xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]{1,2}">
        <xs:annotation>
          <xs:documentation>Minimum number of drives, from 0 to 99.</xs:documentation>
        </xs:annotation>
      </xs:pattern>
    </xs:restriction>
  </xs:simpleType>


  <xs:simpleType name="FailActionType">
    <xs:annotation>
      <xs:documentation></xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="FailOnAny">
        <xs:annotation>
          <xs:documentation>Fail the task when any controller found does not match a rule</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="FailOnFirst">
        <xs:annotation>
          <xs:documentation>Fail the task only when the first controller does not match a rule</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="FailOnNone">
        <xs:annotation>
          <xs:documentation>Fail the task only when none of the controllers match a rule</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="ControllerID">
    <xs:annotation>
      <xs:documentation></xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]{1,2}">
        <xs:annotation>
          <xs:documentation>Any number between 0 and 99</xs:documentation>
        </xs:annotation>
      </xs:pattern>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="ControllerMatchType">
    <xs:annotation>
      <xs:documentation></xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="Slot">
        <xs:annotation>
          <xs:documentation>Select any controller</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Any">
        <xs:annotation>
          <xs:documentation>Select any controller</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="AllRemaining">
        <xs:annotation>
          <xs:documentation>Select all remaining controllers</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="SlotType">
    <xs:annotation>
      <xs:documentation></xs:documentation>
    </xs:annotation>
    <xs:union>
      <xs:simpleType>
        <xs:restriction base="xs:integer">
          <xs:pattern value="[0-9]{1,2}">
            <xs:annotation>
              <xs:documentation>A slot number between 0 and 99</xs:documentation>
            </xs:annotation>
          </xs:pattern>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="Embedded">
            <xs:annotation>
              <xs:documentation>Select the internal controller</xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="Percentage">
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="1">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:minInclusive>
      <xs:maxInclusive value="100">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:maxInclusive>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="Gigabytes">
    <xs:restriction base="xs:long">
      <xs:minInclusive value="0">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:minInclusive>
      <xs:maxInclusive value="32767">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:maxInclusive>
    </xs:restriction>
  </xs:simpleType>
  
  
  <xs:simpleType name="LogicalDriveSize">
    <xs:annotation>
      <xs:documentation></xs:documentation>
    </xs:annotation>
    <xs:union>
      <xs:simpleType>
        <xs:restriction base="xs:unsignedLong">
          <xs:annotation>
            <xs:documentation>Size (in GB or percent) to make the logical drive</xs:documentation>
          </xs:annotation>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:pattern value="Maximum">
            <xs:annotation>
              <xs:documentation>Use all available space</xs:documentation>
            </xs:annotation>
          </xs:pattern>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="LogicalDriveTypes">
    <xs:annotation>
      <xs:documentation></xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="MB">
        <xs:annotation>
          <xs:documentation>number specified is a size in megabytes</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="GB">
        <xs:annotation>
          <xs:documentation>number specified is a size in megabytes</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Percent">
        <xs:annotation>
          <xs:documentation>number specified is a size in percentage of available space.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>


  <xs:simpleType name="ComparisonOperators">
    <xs:annotation>
      <xs:documentation></xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="Equals">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="NotEquals">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="GreaterThan">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="GreaterEquals">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="LessThan">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="LessEquals">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="BeginsWith">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="NotBeginsWith">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="EndsWith">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="NotEndsWith">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Contains">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="NotContains">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="IsNull">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>


 
</xs:schema>